package com.yoomiito.app.ui.push

import android.content.Intent
import com.alibaba.fastjson.JSONObject
import com.umeng.message.UmengNotifyClickActivity
import com.yoomiito.app.Constant
import com.yoomiito.app.model.bean.BannerAndIconInfo
import com.yoomiito.app.utils.ActTypeUtils
import org.android.agoo.common.AgooConstants
import com.yoomiito.app.utils.L

/**
 *  厂商通道 是在离线的情况下收到的
 */
class UMPushActivity : UmengNotifyClickActivity() {

    override fun onMessage(p0: Intent?) {
        super.onMessage(p0)
        val message = p0?.getStringExtra(AgooConstants.MESSAGE_BODY)
        val messageJO = JSONObject.parseObject(message)
        val bodyJO = messageJO.getJSONObject("body")
        val custom = bodyJO.getString("custom")
//        val bannerInfo = JSONObject.parseObject(custom, BannerAndIconInfo::class.java)
//        ActTypeUtils.handleActFromType(this,bannerInfo)
        var intent: Intent = packageManager.getLaunchIntentForPackage("com.yoomiito.app")!!
        intent.putExtra(Constant.UM_PUSH_MESSAGE,custom)
        startActivity(intent)
        finish()
    }
}